package com.yuanfengPlus.inventoryAdjustment.controller;



import com.yuanfengPlus.inventoryAdjustment.entity.InventoryAdjustment;
import com.yuanfengPlus.inventoryAdjustment.service.IInventoryAdjustmentService;
import com.yuanfengPlus.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping( "/inventoryAdjustment")
public class InventoryAdjustmentController {
    @Autowired
    public IInventoryAdjustmentService iias;
    //根据不同查询条件查询库存调整单
    @GetMapping("/queryInventoryAdjustment")
    public Result<List<InventoryAdjustment>> queryInventoryAdjustment(@RequestBody Map<String, Object> params) {
        return iias.queryInventoryAdjustment(params);
    }
    //新增库存调整单
    @PostMapping("/addInventoryAdjustment")
    public Result<String> addInventoryAdjustment(@RequestBody InventoryAdjustment inventoryAdjustment) {
        return iias.addInventoryAdjustment(inventoryAdjustment);
    }
    //根据ID查询库存调整单
    @GetMapping("/queryInventoryAdjustmentById")
    public Result<InventoryAdjustment> queryInventoryAdjustmentById(@RequestBody String document_ID) {
        return iias.queryInventoryAdjustmentById(document_ID);
    }
    //修改库存调整单
    @PostMapping("/updateInventoryAdjustmentById")
    public Result<String> updateInventoryAdjustmentById(@RequestBody InventoryAdjustment inventoryAdjustment) {
        return iias.updateInventoryAdjustmentById(inventoryAdjustment);
    }
    //删除库存调整单
    @PostMapping("/deleteInventoryAdjustment")
    public Result<String> deleteInventoryAdjustment(String document_ID) {
        return iias.deleteInventoryAdjustment(document_ID);
    }
    //审核通过
    @PostMapping("/updateInventoryAdjustmentAgree")
    public Result<String> updateInventoryAdjustmentAgree(String document_ID) {
        System.out.println(document_ID);
        return iias.updateInventoryAdjustmentAgree(document_ID);
    }
    //审核拒绝
    @PostMapping("/updateInventoryAdjustmentRefuse")
    public Result<String> updateInventoryAdjustmentRefuse(String document_ID) {
        System.out.println(document_ID);
        return iias.updateInventoryAdjustmentRefuse(document_ID);
    }
}
